<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户列表 - 助学贷款管理系统</title>
    <link rel="stylesheet" href="./static/layui/css/layui.css">
    <link rel="stylesheet" href="./static/admin/css/style.css">
    <script src="./static/layui/layui.js"></script>
    <script src="./static/js/jquery-3.3.1.min.js"></script>
    <script src="./static/js/vue.min.js"></script>
    <script src="./static/admin/js/config.js"></script>
</head>
<body class="p20">
<div class="layui-row">
    <form class="form-inline" action="/listUserVague.do?realname=" method="get">
        <div class="layui-col-lg8">
            <div class="layui-input-inline" style="width: 300px">
                <input type="text" name="realname" value="" placeholder="用户名" class="layui-input key">
            </div>
            <button type="submit" class="layui-btn sou">查询</button>
        </div>
    </form>
</div>

<table class="layui-table layui-form">

    <thead>
    <tr>
        <th><a>ID</a></th>
        <th>用户名</th>
        <th>真实姓名</th>
        <th>性别</th>
        <th>年龄</th>
        <th>学校</th>
        <th>专业</th>
        <th>状态</th>
        <th><a>操作</a></th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${userList}" var="s" varStatus="status">
        <tr class="id36567">
            <td>${s.id}</td>
            <td>${s.username}</td>
            <td>${s.realname}</td>
            <td>${s.sex}</td>
            <td>${s.age}</td>
            <td>${s.school}</td>
            <td>${s.major}</td>
            <c:if test="${s.status == 1}"><td>正常</td></c:if>
            <c:if test="${s.status == 0}"><td>封禁</td></c:if>
            <c:if test="${s.status == 2}"><td>申请解封</td></c:if>
            <td>
                <button type="button" class="layui-btn layui-btn-sm" onclick="jump(${s.id})">信息维护</button>
                <button type="button" class="layui-btn layui-btn-sm" onclick="adminUserPwd(${s.id})">修改密码</button>
                <c:if test="${s.status == 1}"><button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="adminBanStatus(${s.id})">封禁</button></c:if>
                <c:if test="${s.status == 0}"><button type="button" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-disabled" >封禁</button></c:if>
                <c:if test="${s.status == 2}"><button type="button" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-disabled" >封禁</button></c:if>
                <c:if test="${s.status == 0}"><button class="layui-btn layui-btn-sm  layui-btn-danger" onclick="adminAuditStatus(${s.id})">解封</button></c:if>
                <c:if test="${s.status == 2}"><button class="layui-btn layui-btn-sm  layui-btn-danger" onclick="adminAuditStatus(${s.id})">解封</button></c:if>
                <c:if test="${s.status == 1}"><button class="layui-btn layui-btn-sm  layui-btn-danger layui-btn-disabled" onclick="">解封</button></c:if>
                <button type="button" class="layui-btn layui-btn-sm  layui-btn-danger" onclick="adminDelUser(${s.id})">删除</button>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>




<script src="./static/admin/js/script.js"></script>
<script type="text/javascript" language="javascript">
    function adminDelUser(id)
    {
        var message=confirm("你确定要删除这条信息吗？");
        if(message===true)
        {
            window.location.href="adminDelUser.do?id="+id;
        }
        else if(message==false)
        {
            window.location.href="listUser.do";
        }
    }
    function jump(id) {
        window.location.href="findUserInfo.do?id="+id;
    }
    function adminUserPwd(id) {
        window.location.href="adminUserPwd?id="+id;
    }
    function adminAuditStatus(id) {
        var message=confirm("你确定要解封此账号吗？");
        if(message===true)
        {
            window.location.href="adminAuditStatus.do?id="+id;
        }
        else if(message==false)
        {
            window.location.href="adminListUser.do";
        }
    }
    function adminBanStatus(id) {
        var message=confirm("你确定要封禁此账号吗？");
        if(message===true)
        {
            window.location.href="adminBanStatus.do?id="+id;
        }
        else if(message==false)
        {
            window.location.href="adminListUser.do";
        }
    }
</script>
</body>
</html>
